
: data[] ( -- addr #cells )
  r@ 2+  r@ @ dup cells  2+ r> + >r ;

asm: data[] ( -- addr #cells )
    r3 *+ r1 mov,   \ get #cells in r1
    sp dect,        \ make space on the stack
    r3 sp ** mov,   \ push the address of the data
    sp dect,        \ make space on the stack 
    r1 sp ** mov,   \ move #cells to stack 
    r1 1 sla,       \ convert to bytes
    r1 r3 a,        \ adjust Forth PC to jump over the data
;asm

HEX CODE: data[] ( -- addr #cells )
C073 0644 C503 0644 C501 0A11 A0C1 ;CODE DECIMAL

variable _state

: data[ ( -- here )
  state @ _state !  state 0!  1 $A068 !
  _state @ if compile data[] here 0 , else here then 
; immediate
 
: ]data  ( here -- )
  dup here swap - 2/ _state @ if 1- swap ! then
  $A068 0!  _state @ state !
; immediate

: test data[ 1 2 3 4 5 ]data ." Hello!" ;




: 12-table ( -- addr #items ) 
     DATA[ 1 12 24 36 48 60 72 84 96 108 120 144 ]DATA ; 
: test 30000 0 do 12-table 2drop loop ;
Assember: 7 seconds
Forth: 20 seconds
65% faster